package com.momo.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.FilterRegistration;

@Configuration
public class FilterConfiguration {

    @Bean
    FilterRegistrationBean<Filter3> filter3FilterRegistration(){
        //创建一个过滤器注册Bean给spring使用
        FilterRegistrationBean<Filter3> bean = new FilterRegistrationBean<>();
        //设置过滤顺序
        bean.setOrder(98);
        //设置过滤路径
        bean.setFilter(new Filter3());
        return bean;

    }

    @Bean
    FilterRegistrationBean<Filter2> filter2FilterRegistration(){
        //创建一个过滤器注册Bean给spring使用
        FilterRegistrationBean<Filter2> bean = new FilterRegistrationBean<>();
        //设置过滤顺序
        bean.setOrder(99);
        //设置过滤路径
        bean.setFilter(new Filter2());
        return bean;
    }


}
